
_zombie:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:
#include "stat.h"
#include "user.h"

int
main(void)
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	83 e4 f0             	and    $0xfffffff0,%esp
   6:	83 ec 10             	sub    $0x10,%esp
  if(fork() > 0)
   9:	e8 7e 02 00 00       	call   28c <fork>
   e:	85 c0                	test   %eax,%eax
  10:	7e 0c                	jle    1e <main+0x1e>
    sleep(5);  // Let child exit before parent.
  12:	c7 04 24 05 00 00 00 	movl   $0x5,(%esp)
  19:	e8 06 03 00 00       	call   324 <sleep>
  exit();
  1e:	e8 71 02 00 00       	call   294 <exit>
  23:	90                   	nop
  24:	90                   	nop
  25:	90                   	nop
  26:	90                   	nop
  27:	90                   	nop
  28:	90                   	nop
  29:	90                   	nop
  2a:	90                   	nop
  2b:	90                   	nop
  2c:	90                   	nop
  2d:	90                   	nop
  2e:	90                   	nop
  2f:	90                   	nop

00000030 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
  30:	53                   	push   %ebx
  31:	8b 44 24 08          	mov    0x8(%esp),%eax
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
  35:	31 d2                	xor    %edx,%edx
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
  37:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
  3b:	90                   	nop
  3c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
  40:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
  44:	88 0c 10             	mov    %cl,(%eax,%edx,1)
  47:	83 c2 01             	add    $0x1,%edx
  4a:	84 c9                	test   %cl,%cl
  4c:	75 f2                	jne    40 <strcpy+0x10>
    ;
  return os;
}
  4e:	5b                   	pop    %ebx
  4f:	c3                   	ret    

00000050 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  50:	56                   	push   %esi
  51:	53                   	push   %ebx
  52:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
  56:	8b 54 24 10          	mov    0x10(%esp),%edx
  while(*p && *p == *q)
  5a:	0f b6 01             	movzbl (%ecx),%eax
  5d:	0f b6 1a             	movzbl (%edx),%ebx
  60:	84 c0                	test   %al,%al
  62:	74 24                	je     88 <strcmp+0x38>
  64:	38 d8                	cmp    %bl,%al
  66:	74 11                	je     79 <strcmp+0x29>
  68:	eb 2e                	jmp    98 <strcmp+0x48>
  6a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  70:	83 c1 01             	add    $0x1,%ecx
  73:	38 d8                	cmp    %bl,%al
  75:	75 21                	jne    98 <strcmp+0x48>
    p++, q++;
  77:	89 f2                	mov    %esi,%edx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  79:	0f b6 41 01          	movzbl 0x1(%ecx),%eax
    p++, q++;
  7d:	8d 72 01             	lea    0x1(%edx),%esi
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  80:	0f b6 5a 01          	movzbl 0x1(%edx),%ebx
  84:	84 c0                	test   %al,%al
  86:	75 e8                	jne    70 <strcmp+0x20>
    p++, q++;
  return (uchar)*p - (uchar)*q;
  88:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  8b:	31 c0                	xor    %eax,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
  8d:	29 d8                	sub    %ebx,%eax
}
  8f:	5b                   	pop    %ebx
  90:	5e                   	pop    %esi
  91:	c3                   	ret    
  92:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
    p++, q++;
  return (uchar)*p - (uchar)*q;
  98:	0f b6 db             	movzbl %bl,%ebx
}

int
strcmp(const char *p, const char *q)
{
  while(*p && *p == *q)
  9b:	0f b6 c0             	movzbl %al,%eax
    p++, q++;
  return (uchar)*p - (uchar)*q;
  9e:	29 d8                	sub    %ebx,%eax
}
  a0:	5b                   	pop    %ebx
  a1:	5e                   	pop    %esi
  a2:	c3                   	ret    
  a3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  a9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000000b0 <strlen>:

uint
strlen(char *s)
{
  b0:	8b 4c 24 04          	mov    0x4(%esp),%ecx
  int n;

  for(n = 0; s[n]; n++)
  b4:	31 c0                	xor    %eax,%eax
  b6:	80 39 00             	cmpb   $0x0,(%ecx)
  b9:	74 10                	je     cb <strlen+0x1b>
  bb:	31 d2                	xor    %edx,%edx
  bd:	8d 76 00             	lea    0x0(%esi),%esi
  c0:	83 c2 01             	add    $0x1,%edx
  c3:	80 3c 11 00          	cmpb   $0x0,(%ecx,%edx,1)
  c7:	89 d0                	mov    %edx,%eax
  c9:	75 f5                	jne    c0 <strlen+0x10>
    ;
  return n;
}
  cb:	f3 c3                	repz ret 
  cd:	8d 76 00             	lea    0x0(%esi),%esi

000000d0 <memset>:

void*
memset(void *dst, int c, uint n)
{
  d0:	57                   	push   %edi
  d1:	8b 54 24 08          	mov    0x8(%esp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
  d5:	8b 4c 24 10          	mov    0x10(%esp),%ecx
  d9:	8b 44 24 0c          	mov    0xc(%esp),%eax
  dd:	89 d7                	mov    %edx,%edi
  df:	fc                   	cld    
  e0:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
  e2:	89 d0                	mov    %edx,%eax
  e4:	5f                   	pop    %edi
  e5:	c3                   	ret    
  e6:	8d 76 00             	lea    0x0(%esi),%esi
  e9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000000f0 <strchr>:

char*
strchr(const char *s, char c)
{
  f0:	8b 44 24 04          	mov    0x4(%esp),%eax
  f4:	0f b6 4c 24 08       	movzbl 0x8(%esp),%ecx
  for(; *s; s++)
  f9:	0f b6 10             	movzbl (%eax),%edx
  fc:	84 d2                	test   %dl,%dl
  fe:	74 1d                	je     11d <strchr+0x2d>
    if(*s == c)
 100:	38 ca                	cmp    %cl,%dl
 102:	75 0e                	jne    112 <strchr+0x22>
 104:	eb 1c                	jmp    122 <strchr+0x32>
 106:	66 90                	xchg   %ax,%ax
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 108:	83 c0 01             	add    $0x1,%eax
    if(*s == c)
 10b:	38 ca                	cmp    %cl,%dl
 10d:	8d 76 00             	lea    0x0(%esi),%esi
 110:	74 0e                	je     120 <strchr+0x30>
}

char*
strchr(const char *s, char c)
{
  for(; *s; s++)
 112:	0f b6 50 01          	movzbl 0x1(%eax),%edx
 116:	84 d2                	test   %dl,%dl
 118:	75 ee                	jne    108 <strchr+0x18>
    if(*s == c)
      return (char*) s;
  return 0;
 11a:	31 c0                	xor    %eax,%eax
 11c:	c3                   	ret    
 11d:	31 c0                	xor    %eax,%eax
 11f:	90                   	nop
}
 120:	f3 c3                	repz ret 
 122:	f3 c3                	repz ret 
 124:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 12a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000130 <gets>:

char*
gets(char *buf, int max)
{
 130:	55                   	push   %ebp
 131:	57                   	push   %edi
 132:	56                   	push   %esi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 133:	31 f6                	xor    %esi,%esi
  return 0;
}

char*
gets(char *buf, int max)
{
 135:	53                   	push   %ebx
 136:	83 ec 2c             	sub    $0x2c,%esp
 139:	8b 7c 24 40          	mov    0x40(%esp),%edi
 13d:	8b 6c 24 44          	mov    0x44(%esp),%ebp
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 141:	eb 38                	jmp    17b <gets+0x4b>
 143:	90                   	nop
 144:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    cc = read(0, &c, 1);
 148:	8d 44 24 1f          	lea    0x1f(%esp),%eax
 14c:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 153:	00 
 154:	89 44 24 04          	mov    %eax,0x4(%esp)
 158:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 15f:	e8 48 01 00 00       	call   2ac <read>
    if(cc < 1)
 164:	85 c0                	test   %eax,%eax
 166:	7e 1a                	jle    182 <gets+0x52>
      break;
    buf[i++] = c;
 168:	0f b6 44 24 1f       	movzbl 0x1f(%esp),%eax
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 16d:	89 de                	mov    %ebx,%esi
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
 16f:	3c 0d                	cmp    $0xd,%al

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
 171:	88 44 1f ff          	mov    %al,-0x1(%edi,%ebx,1)
    if(c == '\n' || c == '\r')
 175:	74 0b                	je     182 <gets+0x52>
 177:	3c 0a                	cmp    $0xa,%al
 179:	74 07                	je     182 <gets+0x52>
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 17b:	8d 5e 01             	lea    0x1(%esi),%ebx
 17e:	39 eb                	cmp    %ebp,%ebx
 180:	7c c6                	jl     148 <gets+0x18>
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
 182:	c6 04 37 00          	movb   $0x0,(%edi,%esi,1)
  return buf;
}
 186:	83 c4 2c             	add    $0x2c,%esp
 189:	89 f8                	mov    %edi,%eax
 18b:	5b                   	pop    %ebx
 18c:	5e                   	pop    %esi
 18d:	5f                   	pop    %edi
 18e:	5d                   	pop    %ebp
 18f:	c3                   	ret    

00000190 <stat>:

int
stat(char *n, struct statt *st)
{
 190:	83 ec 1c             	sub    $0x1c,%esp
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 193:	8b 44 24 20          	mov    0x20(%esp),%eax
  return buf;
}

int
stat(char *n, struct statt *st)
{
 197:	89 5c 24 14          	mov    %ebx,0x14(%esp)
 19b:	89 74 24 18          	mov    %esi,0x18(%esp)
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
 19f:	be ff ff ff ff       	mov    $0xffffffff,%esi
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1a4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
 1ab:	00 
 1ac:	89 04 24             	mov    %eax,(%esp)
 1af:	e8 20 01 00 00       	call   2d4 <open>
  if(fd < 0)
 1b4:	85 c0                	test   %eax,%eax
stat(char *n, struct statt *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 1b6:	89 c3                	mov    %eax,%ebx
  if(fd < 0)
 1b8:	78 1a                	js     1d4 <stat+0x44>
    return -1;
  r = fstat(fd, st);
 1ba:	8b 44 24 24          	mov    0x24(%esp),%eax
 1be:	89 1c 24             	mov    %ebx,(%esp)
 1c1:	89 44 24 04          	mov    %eax,0x4(%esp)
 1c5:	e8 22 01 00 00       	call   2ec <fstat>
  close(fd);
 1ca:	89 1c 24             	mov    %ebx,(%esp)
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
 1cd:	89 c6                	mov    %eax,%esi
  close(fd);
 1cf:	e8 e8 00 00 00       	call   2bc <close>
  return r;
}
 1d4:	89 f0                	mov    %esi,%eax
 1d6:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 1da:	8b 74 24 18          	mov    0x18(%esp),%esi
 1de:	83 c4 1c             	add    $0x1c,%esp
 1e1:	c3                   	ret    
 1e2:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 1e9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000001f0 <atoi>:

int
atoi(const char *s)
{
 1f0:	53                   	push   %ebx
 1f1:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  int n;

  n = 0;
 1f5:	31 c0                	xor    %eax,%eax
  while('0' <= *s && *s <= '9')
 1f7:	0f b6 11             	movzbl (%ecx),%edx
 1fa:	8d 5a d0             	lea    -0x30(%edx),%ebx
 1fd:	80 fb 09             	cmp    $0x9,%bl
 200:	77 1e                	ja     220 <atoi+0x30>
 202:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    n = n*10 + *s++ - '0';
 208:	0f be d2             	movsbl %dl,%edx
 20b:	83 c1 01             	add    $0x1,%ecx
 20e:	8d 04 80             	lea    (%eax,%eax,4),%eax
 211:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 215:	0f b6 11             	movzbl (%ecx),%edx
 218:	8d 5a d0             	lea    -0x30(%edx),%ebx
 21b:	80 fb 09             	cmp    $0x9,%bl
 21e:	76 e8                	jbe    208 <atoi+0x18>
    n = n*10 + *s++ - '0';
  return n;
}
 220:	5b                   	pop    %ebx
 221:	c3                   	ret    
 222:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 229:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000230 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 230:	56                   	push   %esi
 231:	53                   	push   %ebx
 232:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 236:	8b 44 24 0c          	mov    0xc(%esp),%eax
 23a:	8b 74 24 10          	mov    0x10(%esp),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 23e:	85 db                	test   %ebx,%ebx
 240:	7e 14                	jle    256 <memmove+0x26>
    n = n*10 + *s++ - '0';
  return n;
}

void*
memmove(void *vdst, void *vsrc, int n)
 242:	31 d2                	xor    %edx,%edx
 244:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
    *dst++ = *src++;
 248:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 24c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 24f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 252:	39 da                	cmp    %ebx,%edx
 254:	75 f2                	jne    248 <memmove+0x18>
    *dst++ = *src++;
  return vdst;
}
 256:	5b                   	pop    %ebx
 257:	5e                   	pop    %esi
 258:	c3                   	ret    
 259:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00000260 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
 260:	56                   	push   %esi
 261:	53                   	push   %ebx
 262:	8b 5c 24 14          	mov    0x14(%esp),%ebx
 266:	8b 44 24 0c          	mov    0xc(%esp),%eax
 26a:	8b 74 24 10          	mov    0x10(%esp),%esi
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 26e:	85 db                	test   %ebx,%ebx
 270:	7e 14                	jle    286 <memcpy+0x26>
 272:	31 d2                	xor    %edx,%edx
 274:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    *dst++ = *src++;
 278:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
 27c:	88 0c 10             	mov    %cl,(%eax,%edx,1)
 27f:	83 c2 01             	add    $0x1,%edx
{
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 282:	39 da                	cmp    %ebx,%edx
 284:	75 f2                	jne    278 <memcpy+0x18>

void *
memcpy(void *dst, const void *src, uint n)
{
  return memmove(dst, src, n);
}
 286:	5b                   	pop    %ebx
 287:	5e                   	pop    %esi
 288:	c3                   	ret    
 289:	90                   	nop
 28a:	90                   	nop
 28b:	90                   	nop

0000028c <fork>:
 28c:	b8 01 00 00 00       	mov    $0x1,%eax
 291:	cd 40                	int    $0x40
 293:	c3                   	ret    

00000294 <exit>:
 294:	b8 02 00 00 00       	mov    $0x2,%eax
 299:	cd 40                	int    $0x40
 29b:	c3                   	ret    

0000029c <wait>:
 29c:	b8 03 00 00 00       	mov    $0x3,%eax
 2a1:	cd 40                	int    $0x40
 2a3:	c3                   	ret    

000002a4 <pipe>:
 2a4:	b8 04 00 00 00       	mov    $0x4,%eax
 2a9:	cd 40                	int    $0x40
 2ab:	c3                   	ret    

000002ac <read>:
 2ac:	b8 06 00 00 00       	mov    $0x6,%eax
 2b1:	cd 40                	int    $0x40
 2b3:	c3                   	ret    

000002b4 <write>:
 2b4:	b8 05 00 00 00       	mov    $0x5,%eax
 2b9:	cd 40                	int    $0x40
 2bb:	c3                   	ret    

000002bc <close>:
 2bc:	b8 07 00 00 00       	mov    $0x7,%eax
 2c1:	cd 40                	int    $0x40
 2c3:	c3                   	ret    

000002c4 <kill>:
 2c4:	b8 08 00 00 00       	mov    $0x8,%eax
 2c9:	cd 40                	int    $0x40
 2cb:	c3                   	ret    

000002cc <exec>:
 2cc:	b8 09 00 00 00       	mov    $0x9,%eax
 2d1:	cd 40                	int    $0x40
 2d3:	c3                   	ret    

000002d4 <open>:
 2d4:	b8 0a 00 00 00       	mov    $0xa,%eax
 2d9:	cd 40                	int    $0x40
 2db:	c3                   	ret    

000002dc <mknod>:
 2dc:	b8 0b 00 00 00       	mov    $0xb,%eax
 2e1:	cd 40                	int    $0x40
 2e3:	c3                   	ret    

000002e4 <unlink>:
 2e4:	b8 0c 00 00 00       	mov    $0xc,%eax
 2e9:	cd 40                	int    $0x40
 2eb:	c3                   	ret    

000002ec <fstat>:
 2ec:	b8 0d 00 00 00       	mov    $0xd,%eax
 2f1:	cd 40                	int    $0x40
 2f3:	c3                   	ret    

000002f4 <link>:
 2f4:	b8 0e 00 00 00       	mov    $0xe,%eax
 2f9:	cd 40                	int    $0x40
 2fb:	c3                   	ret    

000002fc <mkdir>:
 2fc:	b8 0f 00 00 00       	mov    $0xf,%eax
 301:	cd 40                	int    $0x40
 303:	c3                   	ret    

00000304 <chdir>:
 304:	b8 10 00 00 00       	mov    $0x10,%eax
 309:	cd 40                	int    $0x40
 30b:	c3                   	ret    

0000030c <dup>:
 30c:	b8 11 00 00 00       	mov    $0x11,%eax
 311:	cd 40                	int    $0x40
 313:	c3                   	ret    

00000314 <getpid>:
 314:	b8 12 00 00 00       	mov    $0x12,%eax
 319:	cd 40                	int    $0x40
 31b:	c3                   	ret    

0000031c <sbrk>:
 31c:	b8 13 00 00 00       	mov    $0x13,%eax
 321:	cd 40                	int    $0x40
 323:	c3                   	ret    

00000324 <sleep>:
 324:	b8 14 00 00 00       	mov    $0x14,%eax
 329:	cd 40                	int    $0x40
 32b:	c3                   	ret    
 32c:	90                   	nop
 32d:	90                   	nop
 32e:	90                   	nop
 32f:	90                   	nop

00000330 <putc>:
#include "stat.h"
#include "user.h"

static void
putc(int fd, char c)
{
 330:	83 ec 2c             	sub    $0x2c,%esp
 333:	88 54 24 1c          	mov    %dl,0x1c(%esp)
  write(fd, &c, 1);
 337:	8d 54 24 1c          	lea    0x1c(%esp),%edx
 33b:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
 342:	00 
 343:	89 54 24 04          	mov    %edx,0x4(%esp)
 347:	89 04 24             	mov    %eax,(%esp)
 34a:	e8 65 ff ff ff       	call   2b4 <write>
}
 34f:	83 c4 2c             	add    $0x2c,%esp
 352:	c3                   	ret    
 353:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 359:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00000360 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 360:	57                   	push   %edi
 361:	56                   	push   %esi
 362:	53                   	push   %ebx
 363:	89 c3                	mov    %eax,%ebx
 365:	83 ec 10             	sub    $0x10,%esp
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 368:	8b 44 24 20          	mov    0x20(%esp),%eax
 36c:	85 c0                	test   %eax,%eax
 36e:	74 60                	je     3d0 <printint+0x70>
 370:	89 d0                	mov    %edx,%eax
 372:	c1 e8 1f             	shr    $0x1f,%eax
 375:	84 c0                	test   %al,%al
 377:	74 57                	je     3d0 <printint+0x70>
    neg = 1;
    x = -xx;
 379:	89 d0                	mov    %edx,%eax
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
 37b:	bf 01 00 00 00       	mov    $0x1,%edi
    x = -xx;
 380:	f7 d8                	neg    %eax
  } else {
    x = xx;
  }

  i = 0;
 382:	31 f6                	xor    %esi,%esi
 384:	eb 04                	jmp    38a <printint+0x2a>
 386:	66 90                	xchg   %ax,%ax
  do{
    buf[i++] = digits[x % base];
 388:	89 d6                	mov    %edx,%esi
 38a:	31 d2                	xor    %edx,%edx
 38c:	f7 f1                	div    %ecx
 38e:	0f b6 92 ad 06 00 00 	movzbl 0x6ad(%edx),%edx
  }while((x /= base) != 0);
 395:	85 c0                	test   %eax,%eax
    x = xx;
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 397:	88 14 34             	mov    %dl,(%esp,%esi,1)
 39a:	8d 56 01             	lea    0x1(%esi),%edx
  }while((x /= base) != 0);
 39d:	75 e9                	jne    388 <printint+0x28>
  if(neg)
 39f:	85 ff                	test   %edi,%edi
 3a1:	74 07                	je     3aa <printint+0x4a>
    buf[i++] = '-';
 3a3:	c6 04 14 2d          	movb   $0x2d,(%esp,%edx,1)
 3a7:	8d 56 02             	lea    0x2(%esi),%edx

  while(--i >= 0)
 3aa:	8d 72 ff             	lea    -0x1(%edx),%esi
 3ad:	8d 76 00             	lea    0x0(%esi),%esi
    putc(fd, buf[i]);
 3b0:	0f be 14 34          	movsbl (%esp,%esi,1),%edx
 3b4:	89 d8                	mov    %ebx,%eax
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 3b6:	83 ee 01             	sub    $0x1,%esi
    putc(fd, buf[i]);
 3b9:	e8 72 ff ff ff       	call   330 <putc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
 3be:	83 fe ff             	cmp    $0xffffffff,%esi
 3c1:	75 ed                	jne    3b0 <printint+0x50>
    putc(fd, buf[i]);
}
 3c3:	83 c4 10             	add    $0x10,%esp
 3c6:	5b                   	pop    %ebx
 3c7:	5e                   	pop    %esi
 3c8:	5f                   	pop    %edi
 3c9:	c3                   	ret    
 3ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 3d0:	89 d0                	mov    %edx,%eax
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
 3d2:	31 ff                	xor    %edi,%edi
 3d4:	eb ac                	jmp    382 <printint+0x22>
 3d6:	8d 76 00             	lea    0x0(%esi),%esi
 3d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

000003e0 <printf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 3e0:	55                   	push   %ebp
 3e1:	57                   	push   %edi
 3e2:	56                   	push   %esi
 3e3:	53                   	push   %ebx
 3e4:	83 ec 2c             	sub    $0x2c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 3e7:	8b 5c 24 44          	mov    0x44(%esp),%ebx
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 3eb:	8b 6c 24 40          	mov    0x40(%esp),%ebp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 3ef:	0f b6 0b             	movzbl (%ebx),%ecx
 3f2:	84 c9                	test   %cl,%cl
 3f4:	0f 84 86 00 00 00    	je     480 <printf+0xa0>
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
 3fa:	8d 44 24 48          	lea    0x48(%esp),%eax
{
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
 3fe:	31 f6                	xor    %esi,%esi
  ap = (uint*)(void*)&fmt + 1;
 400:	89 44 24 1c          	mov    %eax,0x1c(%esp)
 404:	eb 1b                	jmp    421 <printf+0x41>
 406:	66 90                	xchg   %ax,%ax
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 408:	83 f9 25             	cmp    $0x25,%ecx
 40b:	74 7b                	je     488 <printf+0xa8>
        state = '%';
      } else {
        putc(fd, c);
 40d:	0f be d1             	movsbl %cl,%edx
 410:	89 e8                	mov    %ebp,%eax
 412:	e8 19 ff ff ff       	call   330 <putc>
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 417:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 41a:	0f b6 0b             	movzbl (%ebx),%ecx
 41d:	84 c9                	test   %cl,%cl
 41f:	74 5f                	je     480 <printf+0xa0>
    c = fmt[i] & 0xff;
    if(state == 0){
 421:	85 f6                	test   %esi,%esi
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
 423:	0f b6 c9             	movzbl %cl,%ecx
    if(state == 0){
 426:	74 e0                	je     408 <printf+0x28>
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 428:	83 fe 25             	cmp    $0x25,%esi
 42b:	75 ea                	jne    417 <printf+0x37>
      if(c == 'd'){
 42d:	83 f9 64             	cmp    $0x64,%ecx
 430:	0f 84 ba 00 00 00    	je     4f0 <printf+0x110>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 436:	83 f9 70             	cmp    $0x70,%ecx
 439:	74 55                	je     490 <printf+0xb0>
 43b:	83 f9 78             	cmp    $0x78,%ecx
 43e:	66 90                	xchg   %ax,%ax
 440:	74 4e                	je     490 <printf+0xb0>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 442:	83 f9 73             	cmp    $0x73,%ecx
 445:	74 71                	je     4b8 <printf+0xd8>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 447:	83 f9 63             	cmp    $0x63,%ecx
 44a:	0f 84 c3 00 00 00    	je     513 <printf+0x133>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 450:	83 f9 25             	cmp    $0x25,%ecx
        putc(fd, c);
 453:	ba 25 00 00 00       	mov    $0x25,%edx
 458:	89 e8                	mov    %ebp,%eax
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 45a:	74 12                	je     46e <printf+0x8e>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 45c:	89 4c 24 18          	mov    %ecx,0x18(%esp)
 460:	e8 cb fe ff ff       	call   330 <putc>
        putc(fd, c);
 465:	8b 4c 24 18          	mov    0x18(%esp),%ecx
 469:	89 e8                	mov    %ebp,%eax
 46b:	0f be d1             	movsbl %cl,%edx
 46e:	e8 bd fe ff ff       	call   330 <putc>
      }
      state = 0;
 473:	31 f6                	xor    %esi,%esi
      } else if(c == '%'){
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
 475:	83 c3 01             	add    $0x1,%ebx
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 478:	0f b6 0b             	movzbl (%ebx),%ecx
 47b:	84 c9                	test   %cl,%cl
 47d:	75 a2                	jne    421 <printf+0x41>
 47f:	90                   	nop
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 480:	83 c4 2c             	add    $0x2c,%esp
 483:	5b                   	pop    %ebx
 484:	5e                   	pop    %esi
 485:	5f                   	pop    %edi
 486:	5d                   	pop    %ebp
 487:	c3                   	ret    
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
        state = '%';
 488:	be 25 00 00 00       	mov    $0x25,%esi
 48d:	eb 88                	jmp    417 <printf+0x37>
 48f:	90                   	nop
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 490:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 494:	b9 10 00 00 00       	mov    $0x10,%ecx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 499:	31 f6                	xor    %esi,%esi
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
        printint(fd, *ap, 16, 0);
 49b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 4a2:	8b 10                	mov    (%eax),%edx
 4a4:	89 e8                	mov    %ebp,%eax
 4a6:	e8 b5 fe ff ff       	call   360 <printint>
        ap++;
 4ab:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 4b0:	e9 62 ff ff ff       	jmp    417 <printf+0x37>
 4b5:	8d 76 00             	lea    0x0(%esi),%esi
      } else if(c == 's'){
        s = (char*)*ap;
 4b8:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 4bc:	8b 38                	mov    (%eax),%edi
        ap++;
 4be:	83 c0 04             	add    $0x4,%eax
 4c1:	89 44 24 1c          	mov    %eax,0x1c(%esp)
        if(s == 0)
 4c5:	85 ff                	test   %edi,%edi
 4c7:	74 64                	je     52d <printf+0x14d>
          s = "(null)";
        while(*s != 0){
 4c9:	0f b6 17             	movzbl (%edi),%edx
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 4cc:	31 f6                	xor    %esi,%esi
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 4ce:	84 d2                	test   %dl,%dl
 4d0:	0f 84 41 ff ff ff    	je     417 <printf+0x37>
 4d6:	66 90                	xchg   %ax,%ax
          putc(fd, *s);
 4d8:	0f be d2             	movsbl %dl,%edx
          s++;
 4db:	83 c7 01             	add    $0x1,%edi
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
 4de:	89 e8                	mov    %ebp,%eax
 4e0:	e8 4b fe ff ff       	call   330 <putc>
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
 4e5:	0f b6 17             	movzbl (%edi),%edx
 4e8:	84 d2                	test   %dl,%dl
 4ea:	75 ec                	jne    4d8 <printf+0xf8>
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 4ec:	31 f6                	xor    %esi,%esi
 4ee:	eb 85                	jmp    475 <printf+0x95>
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 4f0:	8b 44 24 1c          	mov    0x1c(%esp),%eax
 4f4:	b1 0a                	mov    $0xa,%cl
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 4f6:	66 31 f6             	xor    %si,%si
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
      if(c == 'd'){
        printint(fd, *ap, 10, 1);
 4f9:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 500:	8b 10                	mov    (%eax),%edx
 502:	89 e8                	mov    %ebp,%eax
 504:	e8 57 fe ff ff       	call   360 <printint>
        ap++;
 509:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 50e:	e9 04 ff ff ff       	jmp    417 <printf+0x37>
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 513:	8b 44 24 1c          	mov    0x1c(%esp),%eax
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
        putc(fd, c);
      }
      state = 0;
 517:	31 f6                	xor    %esi,%esi
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
        putc(fd, *ap);
 519:	0f be 10             	movsbl (%eax),%edx
 51c:	89 e8                	mov    %ebp,%eax
 51e:	e8 0d fe ff ff       	call   330 <putc>
        ap++;
 523:	83 44 24 1c 04       	addl   $0x4,0x1c(%esp)
 528:	e9 ea fe ff ff       	jmp    417 <printf+0x37>
        ap++;
      } else if(c == 's'){
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
 52d:	bf a6 06 00 00       	mov    $0x6a6,%edi
 532:	eb 95                	jmp    4c9 <printf+0xe9>
 534:	90                   	nop
 535:	90                   	nop
 536:	90                   	nop
 537:	90                   	nop
 538:	90                   	nop
 539:	90                   	nop
 53a:	90                   	nop
 53b:	90                   	nop
 53c:	90                   	nop
 53d:	90                   	nop
 53e:	90                   	nop
 53f:	90                   	nop

00000540 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 540:	57                   	push   %edi
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 541:	a1 58 09 00 00       	mov    0x958,%eax
static Header base;
static Header *freep;

void
free(void *ap)
{
 546:	56                   	push   %esi
 547:	53                   	push   %ebx
 548:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  Header *bp, *p;

  bp = (Header*) ap - 1;
 54c:	8d 4b f8             	lea    -0x8(%ebx),%ecx
 54f:	90                   	nop
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 550:	39 c8                	cmp    %ecx,%eax
 552:	8b 10                	mov    (%eax),%edx
 554:	73 04                	jae    55a <free+0x1a>
 556:	39 d1                	cmp    %edx,%ecx
 558:	72 16                	jb     570 <free+0x30>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 55a:	39 d0                	cmp    %edx,%eax
 55c:	72 08                	jb     566 <free+0x26>
 55e:	39 c8                	cmp    %ecx,%eax
 560:	72 0e                	jb     570 <free+0x30>
 562:	39 d1                	cmp    %edx,%ecx
 564:	72 0a                	jb     570 <free+0x30>
static Header base;
static Header *freep;

void
free(void *ap)
{
 566:	89 d0                	mov    %edx,%eax
 568:	eb e6                	jmp    550 <free+0x10>
 56a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
 570:	8b 73 fc             	mov    -0x4(%ebx),%esi
 573:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 576:	39 d7                	cmp    %edx,%edi
 578:	74 18                	je     592 <free+0x52>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
 57a:	89 53 f8             	mov    %edx,-0x8(%ebx)
  if(p + p->s.size == bp){
 57d:	8b 50 04             	mov    0x4(%eax),%edx
 580:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 583:	39 f1                	cmp    %esi,%ecx
 585:	74 22                	je     5a9 <free+0x69>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 587:	89 08                	mov    %ecx,(%eax)
  freep = p;
 589:	a3 58 09 00 00       	mov    %eax,0x958
}
 58e:	5b                   	pop    %ebx
 58f:	5e                   	pop    %esi
 590:	5f                   	pop    %edi
 591:	c3                   	ret    
  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
 592:	03 72 04             	add    0x4(%edx),%esi
 595:	89 73 fc             	mov    %esi,-0x4(%ebx)
    bp->s.ptr = p->s.ptr->s.ptr;
 598:	8b 10                	mov    (%eax),%edx
 59a:	8b 12                	mov    (%edx),%edx
 59c:	89 53 f8             	mov    %edx,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
 59f:	8b 50 04             	mov    0x4(%eax),%edx
 5a2:	8d 34 d0             	lea    (%eax,%edx,8),%esi
 5a5:	39 f1                	cmp    %esi,%ecx
 5a7:	75 de                	jne    587 <free+0x47>
    p->s.size += bp->s.size;
 5a9:	03 53 fc             	add    -0x4(%ebx),%edx
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
  freep = p;
 5ac:	a3 58 09 00 00       	mov    %eax,0x958
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    p->s.size += bp->s.size;
 5b1:	89 50 04             	mov    %edx,0x4(%eax)
    p->s.ptr = bp->s.ptr;
 5b4:	8b 53 f8             	mov    -0x8(%ebx),%edx
 5b7:	89 10                	mov    %edx,(%eax)
  } else
    p->s.ptr = bp;
  freep = p;
}
 5b9:	5b                   	pop    %ebx
 5ba:	5e                   	pop    %esi
 5bb:	5f                   	pop    %edi
 5bc:	c3                   	ret    
 5bd:	8d 76 00             	lea    0x0(%esi),%esi

000005c0 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 5c0:	57                   	push   %edi
 5c1:	56                   	push   %esi
 5c2:	53                   	push   %ebx
 5c3:	83 ec 10             	sub    $0x10,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
 5c6:	8b 15 58 09 00 00    	mov    0x958,%edx
malloc(uint nbytes)
{
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 5cc:	8b 5c 24 20          	mov    0x20(%esp),%ebx
 5d0:	83 c3 07             	add    $0x7,%ebx
 5d3:	c1 eb 03             	shr    $0x3,%ebx
 5d6:	83 c3 01             	add    $0x1,%ebx
  if((prevp = freep) == 0){
 5d9:	85 d2                	test   %edx,%edx
 5db:	0f 84 9d 00 00 00    	je     67e <malloc+0xbe>
 5e1:	8b 02                	mov    (%edx),%eax
 5e3:	8b 48 04             	mov    0x4(%eax),%ecx
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
 5e6:	39 d9                	cmp    %ebx,%ecx
 5e8:	73 6e                	jae    658 <malloc+0x98>
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 5ea:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 5f1:	eb 0e                	jmp    601 <malloc+0x41>
 5f3:	90                   	nop
 5f4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 5f8:	8b 02                	mov    (%edx),%eax
    if(p->s.size >= nunits){
 5fa:	8b 48 04             	mov    0x4(%eax),%ecx
 5fd:	39 cb                	cmp    %ecx,%ebx
 5ff:	76 57                	jbe    658 <malloc+0x98>
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
 601:	3b 05 58 09 00 00    	cmp    0x958,%eax
 607:	89 c2                	mov    %eax,%edx
 609:	75 ed                	jne    5f8 <malloc+0x38>
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 60b:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 611:	b8 00 80 00 00       	mov    $0x8000,%eax
    nu = PAGE;
 616:	be 00 10 00 00       	mov    $0x1000,%esi
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
 61b:	76 04                	jbe    621 <malloc+0x61>
 61d:	89 f8                	mov    %edi,%eax
 61f:	89 de                	mov    %ebx,%esi
    nu = PAGE;
  p = sbrk(nu * sizeof(Header));
 621:	89 04 24             	mov    %eax,(%esp)
 624:	e8 f3 fc ff ff       	call   31c <sbrk>
  if(p == (char*) -1)
 629:	83 f8 ff             	cmp    $0xffffffff,%eax
 62c:	74 1a                	je     648 <malloc+0x88>
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
 62e:	89 70 04             	mov    %esi,0x4(%eax)
  free((void*)(hp + 1));
 631:	83 c0 08             	add    $0x8,%eax
 634:	89 04 24             	mov    %eax,(%esp)
 637:	e8 04 ff ff ff       	call   540 <free>
  return freep;
 63c:	8b 15 58 09 00 00    	mov    0x958,%edx
      }
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
 642:	85 d2                	test   %edx,%edx
 644:	75 b2                	jne    5f8 <malloc+0x38>
 646:	66 90                	xchg   %ax,%ax
        return 0;
  }
}
 648:	83 c4 10             	add    $0x10,%esp
      freep = prevp;
      return (void*) (p + 1);
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
 64b:	31 c0                	xor    %eax,%eax
  }
}
 64d:	5b                   	pop    %ebx
 64e:	5e                   	pop    %esi
 64f:	5f                   	pop    %edi
 650:	c3                   	ret    
 651:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
 658:	39 cb                	cmp    %ecx,%ebx
 65a:	74 1c                	je     678 <malloc+0xb8>
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
 65c:	29 d9                	sub    %ebx,%ecx
 65e:	89 48 04             	mov    %ecx,0x4(%eax)
        p += p->s.size;
 661:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
        p->s.size = nunits;
 664:	89 58 04             	mov    %ebx,0x4(%eax)
      }
      freep = prevp;
 667:	89 15 58 09 00 00    	mov    %edx,0x958
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 66d:	83 c4 10             	add    $0x10,%esp
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 670:	83 c0 08             	add    $0x8,%eax
    }
    if(p == freep)
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 673:	5b                   	pop    %ebx
 674:	5e                   	pop    %esi
 675:	5f                   	pop    %edi
 676:	c3                   	ret    
 677:	90                   	nop
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
    if(p->s.size >= nunits){
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
 678:	8b 08                	mov    (%eax),%ecx
 67a:	89 0a                	mov    %ecx,(%edx)
 67c:	eb e9                	jmp    667 <malloc+0xa7>
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 67e:	c7 05 58 09 00 00 5c 	movl   $0x95c,0x958
 685:	09 00 00 
    base.s.size = 0;
 688:	b8 5c 09 00 00       	mov    $0x95c,%eax
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
  if((prevp = freep) == 0){
    base.s.ptr = freep = prevp = &base;
 68d:	c7 05 5c 09 00 00 5c 	movl   $0x95c,0x95c
 694:	09 00 00 
    base.s.size = 0;
 697:	c7 05 60 09 00 00 00 	movl   $0x0,0x960
 69e:	00 00 00 
 6a1:	e9 44 ff ff ff       	jmp    5ea <malloc+0x2a>
